package com.launcher.wkang.util;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.provider.Browser;

/**
 * Created by lhj on 2018/3/17.
 */

public class BookMarketUtil {
    public static void insertBookMark(Context mContext,int id,String title,String url) {
        ContentValues inputValue = new ContentValues();
        // Bookmark值为1
        inputValue.put("bookmark", id+"");
        // 添加书签Title
        inputValue.put("title", title);
        // 添加书签URL
        inputValue.put("url", url);

        ContentResolver contentResolver = mContext.getContentResolver();

        // 向浏览器添加该书签

        contentResolver.insert(Uri.parse("content://browser/bookmarks"), inputValue);

    }
    public static  void deleteBookMark(Context mContext,int id) {

        ContentResolver contentResolver = mContext.getContentResolver();

        // 删除书签

        int number = contentResolver.delete(Uri.parse("content://browser/bookmarks"),
                        "bookmark=?  ", new String[] {id+""});

    }
}
